function unBindGoods(goodsId,roomId){
	var r=confirm("确认移除商品？");
	if (r==true){
	       $.ajax({
	            url: appServer + "/goods/platformRoom/unBindGoods.json",
	            type: "POST",
	            dataType:"json",
	            data: {'goodsId':goodsId,'id':roomId},
	            success: function(data){
	                if(data.code == 0){
	                    $("#searchForm").submit();
	                }else{
	                    alert(data.msg);
	                    return;
	                }
	            },
	            error: function(res){
	                alert(res.responseText);
	            }
	        });
	}else{
		return;
	}
}

function addRoomGoods() {
	window.open(appServer+'/goods/platformRoom/getUnbindGoodsList.htm?callBack=setRoomGoods', 'newwindow', 'height=400, width=1000, top=20,left=150, toolbar=no, menubar=no, scrollbars=yes, resizable=no,location=no, status=no').focus();
}

function setRoomGoods(json){
	if(json.goodsIds){
		var roomId = $("input[name=platformRoomsId]").val();
		$.ajax({
            url: appServer + "/goods/platformRoom/bindGoods.json",
            type: "POST",
            dataType:"json",
            data: {'goodsIds':json.goodsIds,'id':roomId},
            success: function(data){
                if(data.code == 0){
                    $("#searchForm").submit();
                }else{
                    alert(data.msg);
                    return;
                }
            },
            error: function(res){
                alert(res.responseText);
            }
        });
	}
}